package com.totoro.author.web;

import org.springframework.stereotype.Controller ;
import org.springframework.web.bind.annotation.GetMapping ;
import org.springframework.web.bind.annotation.ResponseBody ;
import org.springframework.web.servlet.ModelAndView ;

import com.totoro.author.author.Access ;
import com.totoro.author.author.CommonIdentifier ;
import com.totoro.author.exception.ExceptionType ;
import com.totoro.author.exception.NoAuthorToPageException ;

/**
 * @author 80002165 @date 2017年8月2日 上午8:59:27
 */
@Controller
public class AuthorTestController {
    
    @GetMapping("/author/exception/json")
    @ResponseBody
    @Access(author=CommonIdentifier.ADMIN)
    public String jsonExceptionTest(){
        return "Hello spring boot！" ;
    }
    
    @GetMapping("/author/test")
    @Access(author=CommonIdentifier.ADMIN , result=ExceptionType.PAGE)
    public String toHelloPage(ModelAndView model){
        return "test" ;
    }
    
    @GetMapping("/author/test/exception")
    public String toPageException(){
        throw new NoAuthorToPageException() ;
    }
    
}
